import Theme from 'vitepress/dist/client/theme-default/index.js'
import Antd from 'ant-design-vue'
import store from '../../../src/store'
import i18n from '../../../src/locales/useI18n'
import SComponents from '../../../src/components/extends'
import vuescroll from 'vuescroll'
import { GET, POST, DELETE, PUT } from '../../../src/api/api.js'
import { TOGGLE_LOADING } from '../../../src/store/mutation-types'
import 'ant-design-vue/dist/antd.variable.min.css'
import '@/style/global.less'

export default {
    ...Theme, // 默认主题
    enhanceApp({ app }) {
        app.use(Antd)
        //引入antd
        app.use(vuescroll)
        app.use(store)
        app.use(i18n)
        //扩展组件
        app.use(SComponents)
        //接口调用入口
        app.config.globalProperties.$loading = function (flag) {
            store.commit(TOGGLE_LOADING, flag)
        }
        app.config.globalProperties.$api = {
            GET: GET,
            POST: POST,
            DELETE: DELETE,
            PUT: PUT
        }
        app.config.globalProperties.CODES = {
            SUCCESS: '000000'
        }
    }
}